<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>文件上传和下载</title>
    <!-- 引入Bootstrap的CSS文件 -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
    <div class="container">
        <h1>文件上传和下载</h1>

        <h2>上传文件</h2>
        <form action="/upload" method="post" enctype="multipart/form-data">
            <div class="input-group mb-3">
                <input type="file" class="form-control" name="file" required>
                <button type="submit" class="btn btn-primary">上传</button>
            </div>
        </form>

        <h2>文件列表</h2>
        <table class="table">
            <thead>
                <tr>
                    <th>文件名</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                <tr th:each="item : ${items}">
                    <td th:text="${item.objectName}"></td>
                    <td>
                        <a th:href="@{'/download/' + ${item.objectName}}" class="btn btn-success">下载</a>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>

    <!-- 引入Bootstrap的JavaScript文件 -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.min.js"></script>
</body>
</html>